#!/bin/bash
set -e

brew update

PACKAGES="cppcheck"

brew_install_or_upgrade() {
    brew install $1 || \
            brew upgrade $1 || \
            brew ls --versions $1 # check if installed last-ly
}

for package in $PACKAGES ; do
	brew_install_or_upgrade "$package"
done
